package hbt;


import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import bean.ClienteBean;
import bean.*;

public class HibernateUtil
{
    private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(ClienteBean.class);
        	 config.addAnnotatedClass(ComparativaPrecios.class);
        	 config.addAnnotatedClass(CondicionBean.class);
        	 config.addAnnotatedClass(CortoPlazoBean.class);
        	 config.addAnnotatedClass(CotizacionBean.class);
        	 config.addAnnotatedClass(DescuentoBean.class);
        	 config.addAnnotatedClass(EfectivoBean.class);
        	 config.addAnnotatedClass(FacturaBean.class);
        	 config.addAnnotatedClass(IOrdenCompraBean.class);
        	 config.addAnnotatedClass(ItemCotizacionBean.class);
        	 config.addAnnotatedClass(ItemOrdenPedidoBean.class);
        	 config.addAnnotatedClass(ItemFacturaBean.class);
        	 config.addAnnotatedClass(MarcaBean.class);
        	 config.addAnnotatedClass(ODVBean.class);
        	 config.addAnnotatedClass(OrdenPedidoBean.class);
        	 config.addAnnotatedClass(OrdenCompraBean.class);
        	 config.addAnnotatedClass(ProveedorBean.class);
        	 config.addAnnotatedClass(RemitoBean.class);
        	 config.addAnnotatedClass(RodamientoBean.class);
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
  
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}
